package pkg.commands;

import pkg.EntityManager;
import pkg.networking.RemoteCommand;

public class SysExecutor implements ICommandExecutor {

	EntityManager manager;
	
	public SysExecutor(EntityManager manager)
	{
		this.manager = manager;
	}
	
	@Override
	public void execute(ICommand command) {
		
		if(!RemoteCommand.isRemoteCommand(command))
			return;
		
		command = RemoteCommand.unpack(command);
		
		if(command instanceof SysCmd.PlayerJoin)
		{
			((SysCmd.PlayerJoin) command).setData(manager);
		   command.execute();
		  ((SysCmd.PlayerJoin) command).setData(null);
		}
		
		
	}

	@Override
	public void setListener(ICommandExecListener listener) {
		// TODO Auto-generated method stub
		
	}
	
	
	
	

}
